package com.wuxiaofan.order.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.order.entity.OrderSetting;
import com.wuxiaofan.order.entity.custom.OrderSettingCustom;
import com.wuxiaofan.order.mapper.OrderSettingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.order.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class OrderSettingService {
    @Autowired
    private OrderSettingMapper omsOrderSettingMapper;
    @Resource
    private Idgenerator idgenerator;
    public OrderSetting findById(String id){
        return omsOrderSettingMapper.selectById(id);
    }

    public OrderSettingCustom findCountByMap(Map paraMap){
        return omsOrderSettingMapper.findCountByMap(paraMap);
    }

    public OrderSettingCustom findGroupByMap(Map paraMap){
        return omsOrderSettingMapper.findGroupByMap(paraMap);
    }

    public List<OrderSettingCustom> findByMap(Map paraMap){
        return omsOrderSettingMapper.findByMap(paraMap);
    }

    public Page<OrderSettingCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(omsOrderSettingMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        omsOrderSettingMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        omsOrderSettingMapper.deleteById(id);
    }

    public OrderSetting save(OrderSetting omsOrderSetting){
        omsOrderSetting.setId(idgenerator.getId());
        omsOrderSettingMapper.insert(omsOrderSetting);
        return omsOrderSetting;
    }

}
